﻿@namespace BootstrapBlazor.Components
@inherits BootstrapInputBase<string>

@if (IsShowLabel)
{
    <BootstrapLabel required="@Required" for="@Id" ShowLabelTooltip="ShowLabelTooltip" Value="@DisplayText" />
}
<div class="@ClassString" @ref="AutoCompleteElement">
    <input @attributes="AdditionalAttributes" id="@Id" class="@ClassName" autocomplete="off" type="@Type" placeholder="@PlaceHolder" disabled="@Disabled" @bind-value="@CurrentValueAsString" @bind-value:event="oninput" @onblur="OnBlur" @onkeyup="OnKeyUp" @ref="FocusElement" />
    <i class="fa fa-fw fa-spinner fa-spin"></i>
    <div class="select-dropdown">
        <ul class="dropdown-list">
            @if (FilterItems.Any())
            {
                @foreach (var item in FilterItems)
                {
                    <li class="dropdown-item" @onmousedown="e => OnClickItem(item)">
                        <div>@item</div>
                    </li>
                }
            }
            else
            {
                <li class="dropdown-item">@NoDataTip</li>
            }
        </ul>
    </div>
</div>
<CascadingValue Value="this" IsFixed="true">
    @ChildContent
</CascadingValue>
